From 126d04c114a56be81dbf4d73d7c7c993a844280f Mon Sep 17 00:00:00 2001 From: Joseph Marrero Corchado Date: Thu, 29 May 2025 14:23:00 -0400 Subject: [PATCH] ostree-prepare-root: make mkdir calls idempotent --- src/switchroot/ostree-prepare-root.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switchroot/ostree-prepare-root.c b/src/switchroot/ostree-prepare-root.c index 4bf180c3..68707f10 100644 --- a/src/switchroot/ostree-prepare-root.c +++ b/src/switchroot/ostree-prepare-root.c @@ -348,7 +348,7 @@ main (int argc, char *argv[]) if (mount (NULL, "/", NULL, MS_REC | MS_PRIVATE | MS_SILENT, NULL) < 0) err (EXIT_FAILURE, "failed to make \"/\" private mount"); - if (mkdir (TMP_SYSROOT, 0755) < 0) + if (mkdir (TMP_SYSROOT, 0755) < 0 && errno != EEXIST) err (EXIT_FAILURE, "couldn't create temporary sysroot %s", TMP_SYSROOT); /* Run in the deploy_path dir so we can use relative paths below */ @@ -384,7 +384,7 @@ main (int argc, char *argv[]) cfs_options.flags = 0; cfs_options.image_mountdir = OSTREE_COMPOSEFS_LOWERMNT; - if (mkdirat (AT_FDCWD, OSTREE_COMPOSEFS_LOWERMNT, 0700) < 0) + if (mkdirat (AT_FDCWD, OSTREE_COMPOSEFS_LOWERMNT, 0700) < 0 && errno != EEXIST) err (EXIT_FAILURE, "Failed to create %s", OSTREE_COMPOSEFS_LOWERMNT); g_autofree char *expected_digest = NULL; -- 2.30.2